package router

import (
	"github.com/gin-gonic/gin"
	"micro-chat/internal/middleware"
	"micro-chat/internal/service"
)

func Router(r *gin.Engine) {
	api := r.Group("/api")
	{
		//短信发送
		r.POST("/sendSms", service.SendSms)
		//用户
		user := api.Group("/user")
		{
			//注册
			user.POST("/register", service.RegisterUser)
			//登陆
			user.POST("login", service.LoginUser)
			//中间件
			user.Use(middleware.Auth())
		}

		//好友
		friend := api.Group("/friend")
		{
			//查询
			friend.GET("findKeyFriend", service.FindKeyFriend)
			//发送申请
			friend.POST("sendApply", service.SendApply)
			//申请查看
			friend.GET("findApply", service.FindApply)
			//申请处理
			friend.POST("applyUpdate", service.ApplyUpdate)
			//好友列表
			friend.GET("listFriend", service.ListFriend)
		}

		//黑名单
		blacklist := api.Group("/blacklist")
		{
			//添加黑名单
			blacklist.POST("addList", service.AddListBlack)
			//查看黑名单
			blacklist.GET("findList", service.FindBlackList)
		}

		//聊天
		chat := api.Group("/chat")
		{
			//消息发送
			chat.GET("chat", service.Chat)
		}

		//朋友圈
		moments := api.Group("/moments")
		{
			//发布朋友圈
			moments.POST("addMoments", service.AddMoments)
			//查看朋友圈
			moments.GET("findMoments", service.FindMoments)
			//点赞
			moments.POST("addMomentLike", service.AddMomentsList)
		}
	}
}
